Skip to content

fix: DH-22326: Un-hide group-by columns, keep other hidden columns hidden when applying rollup#2668

Open
vbabich wants to merge 3 commits intodeephaven:mainfrom
vbabich:vlad-DH-22326
Open

fix: DH-22326: Un-hide group-by columns, keep other hidden columns hidden when applying rollup#2668
vbabich wants to merge 3 commits intodeephaven:mainfrom
vbabich:vlad-DH-22326

Conversation

@vbabich
Copy link
Copy Markdown
Collaborator

@vbabich vbabich commented May 4, 2026

Fix DH-22326: when applying a rollup, group-by columns now become visible while previously hidden non-grouped columns stay hidden across the model swap. Replaces the previous showAllColumns() reset in handleRollupChange with a targeted metricCalculator.resetColumnWidthByName call for each group-by column, so the metric calculator's existing by-name width tracking handles preservation automatically. Also eliminates the brief flicker that the previous reset caused.

@vbabich vbabich changed the title DH-22326: Un-hide group-by columns, keep other hidden columns hidden when applying rollup fix: DH-22326: Un-hide group-by columns, keep other hidden columns hidden when applying rollup May 4, 2026
@vbabich vbabich self-assigned this May 4, 2026
@vbabich vbabich requested a review from Copilot May 4, 2026 19:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates iris-grid rollup handling so applying a rollup no longer unhides every hidden column. Instead, it targets just the selected group-by columns and relies on the grid metric calculator’s name-based width preservation during model swaps.

Changes:

  • Replaced the showAllColumns() reset in handleRollupChange with per-group-column resetColumnWidth calls.
  • Kept the existing rollup state reset/loading flow intact while narrowing the visibility change.
  • Added unit tests for the new handleRollupChange behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/iris-grid/src/IrisGrid.tsx Changes rollup application to selectively unhide grouped columns instead of resetting all hidden columns.
packages/iris-grid/src/IrisGrid.test.tsx Adds unit coverage for the new rollup column-width reset path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/iris-grid/src/IrisGrid.tsx Outdated
Comment thread packages/iris-grid/src/IrisGrid.test.tsx
@vbabich vbabich marked this pull request as ready for review May 4, 2026 20:16
@vbabich vbabich requested a review from Copilot May 4, 2026 20:19
@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.95%. Comparing base (53e35dd) to head (a3cd200).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2668      +/-   ##
==========================================
+ Coverage   49.78%   49.95%   +0.16%     
==========================================
  Files         774      774              
  Lines       43917    43926       +9     
  Branches    11129    11132       +3     
==========================================
+ Hits        21866    21945      +79     
+ Misses      22033    21963      -70     
  Partials       18       18              
Flag Coverage Δ
unit 49.95% <100.00%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +313 to +319
* @param name The name of the column to reset
*/
resetColumnWidthByName(name: ColumnName): void {
this.userColumnWidthsByName.delete(name);
if (this.cachedModelColumnNames != null) {
const index = this.cachedModelColumnNames.indexOf(name);
if (index >= 0) {
Comment on lines +269 to +292
it('un-hides group-by columns by name', () => {
const columns = irisGridTestUtils.makeColumns(3);
const irisGrid = makeComponent(
irisGridTestUtils.makeModel(irisGridTestUtils.makeTable({ columns }))
);
const { metricCalculator } = irisGrid.state;
const resetColumnWidthByName = jest.spyOn(
metricCalculator,
'resetColumnWidthByName'
);

const groupByNames = [columns[1].name, columns[2].name];

act(() => {
irisGrid.handleRollupChange({
columns: groupByNames,
showConstituents: true,
showNonAggregatedColumns: true,
});
});

expect(resetColumnWidthByName).toHaveBeenCalledWith(groupByNames[0]);
expect(resetColumnWidthByName).toHaveBeenCalledWith(groupByNames[1]);
expect(irisGrid.state.rollupConfig?.columns).toEqual(groupByNames);
Comment on lines +332 to +348
// Simulate the column having been hidden previously (width 0 stored by name).
const newGroupByName = 'NotInCurrentModel';
metricCalculator.userColumnWidthsByName.set(newGroupByName, 0);

// Spy AFTER seeding so the spy still calls through.
jest.spyOn(model, 'getColumnIndexByName').mockReturnValue(undefined);

act(() => {
irisGrid.handleRollupChange({
columns: [newGroupByName],
showConstituents: false,
showNonAggregatedColumns: false,
});
});

expect(metricCalculator.userColumnWidthsByName.has(newGroupByName)).toBe(
false
@vbabich
Copy link
Copy Markdown
Collaborator Author

vbabich commented May 4, 2026

Found a bug, fixing:

  • Open stocks table, hide all columns except Random
  • Create a rollup on Sym column - now 2 columns are visible: Sym and Random
  • Reload the browser. The rollup with 2 visible columns is shown correctly.
  • Remove the Sym grouping column in the rollup settings.

Expected:

  • 2 columns stay visible - Sym and Random

Actual:

  • All columns are visible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants